package de.hsowl.tod4a.global.logging;

import java.util.logging.Level;
import java.util.logging.Logger;

/**
 * An Android only logging class
 * 
 * @author Sebastian Witt
 * 
 */
public class JavaLogImpl implements de.hsowl.tod4a.global.logging.Log {

	private Logger log;
	private final String DEBUG = "<DEBUG>";
	private final String VENDOR = "<VENDOR>";
	private final String INFORMATION = "<INFO>";

	public JavaLogImpl(Class<?> clazz) {
		log = Logger.getLogger(clazz.getName());
		log.setLevel(Level.ALL);
		vendor("Java logger created");
	}

	/**
	 * See {@link de.hsowl.tod4a.global.logging.Log#debug(String)}
	 */
	public void debug(String msg) {
		log.info(DEBUG + msg);

	}

	/**
	 * See {@link de.hsowl.tod4a.global.logging.Log#vendor(String)}
	 */
	public void vendor(String msg) {
		log.info(VENDOR + msg);
	}

	/**
	 * See {@link de.hsowl.tod4a.global.logging.Log#error(String)}
	 */
	public void error(String msg) {
		log.warning(msg);
	}

	/**
	 * See {@link de.hsowl.tod4a.global.logging.Log#error(String, Throwable)}
	 */
	public void error(String msg, Throwable e) {
		log.log(Level.WARNING, msg, e);
	}

	/**
	 * See {@link de.hsowl.tod4a.global.logging.Log#debug(String, Throwable)}
	 */
	public void debug(String msg, Throwable e) {
		log.log(Level.INFO, DEBUG + msg, e);
	}

	/**
	 * See {@link de.hsowl.tod4a.global.logging.Log#vendor(String, Throwable)}
	 */
	public void vendor(String msg, Throwable e) {
		log.log(Level.INFO, VENDOR + msg, e);
	}

	/**
	 * See {@link de.hsowl.tod4a.global.logging.Log#information(String)}
	 */
	public void information(String msg) {
		log.log(Level.INFO, INFORMATION + msg);
	}

	/**
	 * See
	 * {@link de.hsowl.tod4a.global.logging.Log#information(String, Throwable)}
	 */
	public void information(String msg, Throwable e) {
		log.log(Level.INFO, INFORMATION + msg, e);
	}

}
